<?php
echo $html->css('/cms/css/jquery.autocomplete.css');
echo $javascript->link('/cms/js/jquery.autocomplete.js');

	$text = @$_GET['search'];
	$location = @$_GET['location'];
	
	$textStr = "";
	$locationStr = "";
	if(isset($locationSearch) && $locationSearch)
	{
		echo $form->create('Listing',array('url'=>"/listings/index/searchLocation"));
		$locationStr = $form->input('location',array('label'=>$locationLabel,'type'=>"text",'value'=>'Where?','class'=>"swap_value"));
	}else
	{
		echo $form->create('Listing',array('url'=>"/listings/index/search"));
	}
	$textStr = $form->input('search',array('label'=>$searchLabel,'type'=>"text",'value'=>'What are you looking for?','class'=>"text_search swap_value"));
	echo $textStr;
	echo $locationStr;
	echo $form->end(array('label'=>__("Go"),'style'=>"float:right"));
?>
<div class="clear"></div>
	<script>
		$(document).ready(function(){
			<?php if(isset($showAutocomplete) && $showAutocomplete) {?>
			$('input.text_search').autocomplete("<?php echo $html->url("/listings/suggest/")?>",{
				
			});
			<?php }?>
			<?php if(strlen($searchLabel)){?>
				//$('#ListingSearch').swapValueHelp(<?php echo $javascript->object($searchLabel)?>);
			<?php }?>
			<?php if(strlen($locationLabel)){?>
				//$('#ListingLocation').swapValueHelp(<?php echo $javascript->object($locationLabel)?>);
			<?php }?>	
		});
	</script>
